package com.platform.tony.utils;

import cn.hutool.core.lang.Snowflake;
import cn.hutool.core.util.StrUtil;

public class IdUtils {

    public static Snowflake flake;

    static {
        flake = new Snowflake();
    }


    public static Long id() {
        return flake.nextId();
    }

    public static String idStr() {
        return flake.nextIdStr();
    }

    public static String code() {
        String s = idStr();
        return StrUtil.subSuf(s, StrUtil.length(s) -6);
    }

    public static void main(String[] args) {
        String code = code();
        System.out.println(code);
    }
}
